Fix/flashlight intensity issue#3733
Conversation
…into fix/flashlight-intensity-issue
kylecorry31
left a comment
There was a problem hiding this comment.
Thank you, looks to be on the right track but there are some changes I would like and a bug that was introduced.
| if (mode != FlashlightMode.Off) { | ||
| selectedMode = mode | ||
| } |
There was a problem hiding this comment.
Is it possible to move this to within the on method so that it is wrapped by the synchronized block?
Moving it there would also allow it to be removed on line 182 as well
|
|
||
| private fun turnOn() { | ||
| flashlight.set(selectedMode) | ||
| flashlight.set(flashlight.selectedMode) |
There was a problem hiding this comment.
I think this should maintain a local selectedMode state (like it did before), and sync that with the flashlight subsystem's mode on resume.
This technique is causing a bug in which when I change the mode and then turn off the flashlight it switches back to 0 without me leaving the page. I would like it to only default back to 0 when I come back to the page and the flashlight is off.
Potentially just the code you have in onResume will do the job, but that will need to be verified.
| FlashlightMode.Torch | ||
| } | ||
| turnOn() | ||
| flashlight.set(mode) |
There was a problem hiding this comment.
I would like both of these flashlight.set lines in this function to be restored to turnOn - that way there's a single point where it is handling that. I think my other comment about the selectedMode bug and bringing back the selectedMode state will allow this to be function to be restored while retaining the behavior we want
Description
Fixed the issue of flashlight selector to currently active
Related Issue
3680
Checklist
Screenshots